﻿using Microsoft.Extensions.Options;
using System;

#nullable enable

namespace NewRetail.Application.Components.WeChat.Configurations
{
    /// <summary>
    /// 微信公众平台的appid等配置
    /// </summary>
    public partial class WeChatOptions : IOptions<WeChatOptions>
    {
        WeChatOptions IOptions<WeChatOptions>.Value => this;

        public WechatAccount[] Accounts { get; set; } = Array.Empty<WechatAccount>();

        public string CallbackState { get; set; } = string.Empty;
        /// <summary>
        /// 微信服务器推送的 Token。
        /// </summary>
        public string CallbackToken { get; set; } = string.Empty;
    }

    partial class WeChatOptions
    {
        public partial class WechatAccount : IOptions<WechatAccount>
        {
            WechatAccount IOptions<WechatAccount>.Value => this;
            public string? GhId { get; set; }
            /// <summary>
            /// 微信 AppId。
            /// </summary>
            public string AppId { get; set; } = string.Empty;
            /// <summary>
            /// 微信 AppSecret
            /// </summary>
            public string AppSecret { get; set; } = string.Empty;
            /// <summary>
            /// 微信服务器推送的 EncodingAESKey。公众平台提供了3种加解密的模式供开发者选择，即明文模式、兼容模式、安全模式(可在“开发者中心”选择相应模式),选择兼容模式和安全模式前，需在开发者中心填写消息加解密密钥EncodingAESKey。
            /// </summary>
            public string? PushEncodingAESKey { get; set; }
            public TemplateMsgSendOptions? TemplateSendInfo { get; set; }
            /// <summary>
            /// 会员卡Id
            /// </summary>
            public string? MemberCardId { get; set; }
        }
        partial class WechatAccount
        {
            public class TemplateMsgSendOptions
            {
                /// <summary>
                /// 关注回复模板消息Id
                /// </summary>
                public string AttentionTemplateId { get; set; } = string.Empty;
                /// <summary>
                /// 购物成功模板消息Id
                /// </summary>
                public string ShoppingTemplateId { get; set; } = string.Empty;
                /// <summary>
                /// 积分兑换代金券模板消息Id
                /// </summary>
                public string IntegralExchangeTemplateId { get; set; } = string.Empty;
            }
        }
    }
}
